package com.zc58s.springbootmqtt;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * <p>
 *
 * </p>
 *
 * @author zhangjian
 * created at 2020/07/29
 */
@Controller
@Slf4j
public class HomeController {

    @Value("${swagger.enable}")
    private boolean swaggerEnabled;


    @GetMapping("/")
    public String index() {
        if (swaggerEnabled) {
            return "redirect:/swagger-ui.html";
        }
        return "redirect:/hi";
    }

    @ResponseBody
    @GetMapping("/hi")
    public String sayHi() {
        return "Hi crungooer~";
    }
}
